from django.shortcuts import render
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
import django.contrib.auth.forms
from django.contrib.auth.forms import UserCreationForm


def home(request):
    return render_to_response('home.html', context_instance=RequestContext(request))

def help(request):
    return render_to_response('help.html', context_instance=RequestContext(request))
    
def register(request):
    if request.method == 'POST':
        form = UserCreationForm(request.POST)
        if form.is_valid():
            form.save()
            return redirect('home')
        else:
             return render(request, 'register.html', {
            'form': form,
        })
    else:
        form = UserCreationForm()
        return render(request, 'register.html', {
            'form': form,
        })
    
